from django.urls import converters


class UserNameIntConverter:
    """用户名校验"""
    regex = r'[a-zA-Z0-9_\u4e00-\u9fa5]{5,20}'

    # regex = '[a-zA-Z0-9_-]{5,20}'

    def to_python(self, value):
        return str(value)


class MobileIntConverter:
    regex = r'1[345789]\d{9}'

    # regex = '[a-zA-Z0-9_-]{5,20}'

    def to_python(self, value):
        return str(value)


class ImageCodeIdConverter:
    regex = r'[\w-]+'

    # regex = '[a-zA-Z0-9_-]{5,20}'

    def to_python(self, value):
        return str(value)
